#ifndef _ThreadPool_H_
#define _ThreadPool_H_

#include "Task.hpp"
#include "Thread.hpp"
#include "TaskQueue.hpp"

#include <memory>
#include <vector>
using std::unique_ptr;
using std::vector;


namespace wd{

class Task;

class ThreadPool{
    friend class WorkerThread;
public:
    ThreadPool(int,int);
    void start();
    void stop();
    void addTask(ElemType && );
private:
    void doTask();
private:
    vector<unique_ptr<Thread>> _threads;
    int _threadNum;
    int _queSize;
    TaskQueue _taskque;
    bool _isExit;
};

}


#endif

